package cn.miao.middle.cloud.core.auth.encoding;

import org.springframework.security.crypto.password.PasswordEncoder;

import cn.miao.middle.cloud.core.util.MD5Util;

/**
 * MD5加密
 * 
 * @author kongyufei
 *
 */
public class MD5PasswordEncoder implements PasswordEncoder {

	@Override
	public String encode(CharSequence rawPassword) {
		return MD5Util.encode(String.valueOf(rawPassword));
	}

	@Override
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		return MD5Util.verify(String.valueOf(rawPassword), encodedPassword);
	}

}
